Component({
  properties: {
    text: {
      type: String,
      value: '加载中...'
    },
    mask: {
      type: Boolean,
      value: true
    }
  },
  data: {
    animationData: null
  },
  lifetimes: {
    attached() {
      this.startRotateAnimation();
    },
    detached() {
      if (this.rotateTimer) {
        clearInterval(this.rotateTimer);
      }
    }
  },
  methods: {
    startRotateAnimation() {
      const animation = wx.createAnimation({
        duration: 1000,
        timingFunction: 'linear'
      });
      
      let rotate = 0;
      this.rotateTimer = setInterval(() => {
        rotate += 360;
        animation.rotate(rotate).step();
        this.setData({
          animationData: animation.export()
        });
      }, 1000);
    }
  }
}); 